<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Login - KitAdminCore</title>
    <script src="../public/jquery/2.1.1/jquery.min.js"></script>
    <script>
        if (window != window.top) top.location.href = self.location.href;
    </script>
    <link href="../public/kitadmin/plugins/layui/css/layui.css">
    <link href="../public/kitadmin/plugins/layui/css/layui.css" rel="stylesheet"/>
    <link href="../public/kitadmin/plugins/font-awesome/css/font-awesome.css" rel="stylesheet"/>
    <link href="../public/kitadmin/build/css/login.css" rel="stylesheet"/>
    <link href="../public/kitadmin/plugins/sideshow/css/normalize.css" rel="stylesheet"/>
    <link href="../public/kitadmin/plugins/sideshow/css/demo.css" rel="stylesheet"/>
    <link href="../public/kitadmin/plugins/sideshow/css/component.css" rel="stylesheet"/>
    <!--[if IE]>
    <script src="./plugins/sideshow/js/html5.js"></script>
    <![endif]-->
    <style>
        canvas {
            position: absolute;
            z-index: -1;
        }

        .kit-login-box header h1 {
            line-height: normal;
        }

        .kit-login-box header {
            height: auto;
        }

        .content {
            position: relative;
        }

        .codrops-demos {
            position: absolute;
            bottom: 0;
            left: 40%;
            z-index: 10;
        }

        .codrops-demos a {
            border: 2px solid rgba(242, 242, 242, 0.41);
            color: rgba(255, 255, 255, 0.51);
        }

        .kit-pull-right button,
        .kit-login-main .layui-form-item input {
            background-color: transparent;
            color: white;
        }

        .kit-login-main .layui-form-item input::-webkit-input-placeholder {
            color: white;
        }

        .kit-login-main .layui-form-item input:-moz-placeholder {
            color: white;
        }

        .kit-login-main .layui-form-item input::-moz-placeholder {
            color: white;
        }

        .kit-login-main .layui-form-item input:-ms-input-placeholder {
            color: white;
        }

        .kit-pull-right button:hover {
            border-color: #009688;
            color: #009688
        }
    </style>
</head>


<body class="kit-login-bg">
<div class="container demo-1">
    <div class="content">
        <div id="large-header" class="large-header">
            <canvas id="demo-canvas"></canvas>
            <div class="kit-login-box">
                <header>
                    <h1>Mqtt 物联管理系统注册</h1>
                </header>
                <div class="kit-login-main">
                    <form action="/" class="layui-form" method="post">
                        <div class="layui-form-item">
                            <label class="kit-login-icon">
                                <i class="layui-icon">&#xe612;</i>
                            </label>
                            <input type="text" name="userName" lay-verify="required" autocomplete="off"
                                   placeholder="请输入手机号" class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="kit-login-icon">
                                <i class="layui-icon">&#xe642;</i>
                            </label>
                            <input type="text" name="validCode" lay-verify="required" autocomplete="off"
                                   placeholder="输入右侧验证码" class="layui-input">
                            <span class="form-code" id="changeCode" style="position:absolute;right:2px; top:2px;">
                                    <img src="../User/LoginAuthCode" id="refImg" style="cursor:pointer;"
                                         title="点击刷新" onclick="this.src='../User/LoginAuthCode'"/>
                                </span>
                        </div>

                        <div class="layui-form-item">
                            <label class="kit-login-icon">
                                <i class="layui-icon">&#xe642;</i>
                            </label>
                            <input type="password" name="password" lay-verify="required" autocomplete="off"
                                   placeholder="请输入密码" class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="kit-login-icon">
                                <i class="layui-icon">&#xe642;</i>
                            </label>
                            <input type="password" name="password" lay-verify="required" autocomplete="off"
                                   placeholder="请输入重复密码" class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="kit-login-icon">
                                <i class="layui-icon">&#xe642;</i>
                            </label>
                            <input type="text" name="validCode" lay-verify="required" autocomplete="off"
                                   placeholder="输入短信验证码" class="layui-input">
                            <span class="form-code" id="changeCode" style="position:absolute;right:2px; top:2px;">
                                    <!--<img src="../User/LoginAuthCode" id="refImg" style="cursor:pointer;"-->
                                <!--title="点击刷新" onclick="this.src='../User/LoginAuthCode?'+Math.random()"/>-->
                                <a href="#" id="SMS_verification_code" style="width: 108px;height: 34px;"
                                   class="layui-btn layui-btn-primary">发送验证码</a>
                                </span>
                        </div>
                        <div class="layui-form-item">
                            <div class="kit-pull-right">
                                <button class="layui-btn layui-btn-primary" lay-submit lay-filter="login">
                                     已经注册返回登录页面
                                </button>
                                <button class="layui-btn layui-btn-primary"> 注册
                                </button>
                            </div>
                            <div class="kit-clear"></div>
                        </div>
                    </form>
                </div>
                <footer>
                    <p>lanmao © <a href="http://xp0310.com" style="color:white; font-size:18px;"
                                   target="_blank">xp0310.com</a></p>
                </footer>
            </div>
        </div>
    </div>
</div>
<!-- /container -->

<script src="../public/kitadmin/plugins/layui/layui.js"></script>
<script src="../public/kitadmin/plugins/sideshow/js/TweenLite.min.js"></script>
<script src="../public/kitadmin/plugins/sideshow/js/EasePack.min.js"></script>
<script src="../public/kitadmin/plugins/sideshow/js/rAF.js"></script>
<script src="../public/kitadmin/plugins/sideshow/js/demo-1.js"></script>
<script>
    layui.use(['layer', 'form'], function () {
            var layer = layui.layer,
                $ = layui.jquery,
                form = layui.form;

            $('#changeCode').on('click', function () {
                $('#changeCode > img')[0].src = '../User/dl_yzm';
            });

            //清理左侧菜单缓存
            var index = layer.load(2, {
                shade: [0.3, '#333']
            });
//        jQuery.post("../User/Login_tojudge", function (data) {
//            data = JSON.parse(data);
//            if (data.status == 0){
//                layer.msg('当前已经登录,欢迎:' + data.UserName + '用户,即将跳转', {icon: 6});
//                setTimeout(function () {
//                    location.href = 'Home'
//                }, 1500);
//            }
//        });
//            var wait=60;
//            function time(o) {
//                if (wait == 0) {
//                    o.removeAttribute("disabled");
//                    o.value="获取验证码";
//                    wait = 60;
//                } else {
//
//                    o.setAttribute("disabled", true);
//                    o.value="重新发送(" + wait + ")";
//                    wait--;
//                    setTimeout(function() {
//                            time(o)
//                        },
//                        1000)
//                }
//            }
            var wait = 60;

            function time(o) {
                if (wait == 0) {
                    document.getElementById('SMS_verification_code').className = "layui-btn layui-btn-primary";
                    o.removeAttribute("disabled");
                    o.innerText = "获取验证码";
                    wait = 60;
                } else {
                    document.getElementById('SMS_verification_code').className = "layui-btn layui-btn-disabled";
                    o.setAttribute("disabled", true);
                    o.innerText = "重新发送(" + wait + ")";
                    wait--;
                    setTimeout(function () {
                            time(o)
                        },
                        1000)
                }
            }

            document.getElementById("SMS_verification_code").onclick = function () {
                time(this);
            }
//            document.getElementById('SMS_verification_code').onclick = function () {
//                //更改class
////                for ()
//
//                var i = 60;
//                var timer = null;
//                timer = setInterval(function () {
//                    i--;
//                    if (i <= 0) {
//                        document.getElementById('SMS_verification_code').className = "layui-btn layui-btn-primary";
//                        document.getElementById('SMS_verification_code').innerText = '发送验证码';
//                        clearInterval(timer);
//                    } else {
//                        document.getElementById('SMS_verification_code').className = "layui-btn layui-btn-disabled";
//                        document.getElementById('SMS_verification_code').innerText = '获取验证码' + i;
//                    }
//                }, 1000)
//
////                document.getElementById("SMS_verification_code").onclick=function(){time(this);}
//
//
////            alert('00');
////            var inde = layer.msg('注销中', {
////                icon: 16
////                , shade: 0.01
////            });
////            $.post("../User/Logout", function (data) {
////                data = JSON.parse(data)
////                if (data.status == 0) {
////                    //注销成功
////                    inde && layer.close(inde);
////                    layer.msg('注销成功,稍等自动为您返回登录页面', {icon: 6});
////                    setTimeout(function () {
////                        location.href = 'Login'
////                    }, 1500);
////                } else {
////                    inde && layer.close(inde);
////                    layer.msg('注销成功,稍等自动为您返回登录页面', {icon: 6});
////                    etTimeout(function () {
////                        location.href = 'Login'
////                    }, 1500);
////                }
////            });
//            };
            $(window).on('load', function () {
                layer.close(index);
                form.on('submit(login)', function (data) {
                    var loadIndex = layer.load(2, {
                        shade: [0.3, '#333']
                    });
//                location.href = '/';
//                jQuery.post("../User/Login", {
//                        Username: $("input[name='userName']").get(0).value,
//                        Password: $("input[name='password']").get(0).value,
//                        Captcha: $("input[name='validCode']").get(0).value
//
//                    }
//                    , function (res) {
//                        var retObj = eval(res);
//                        loadIndex && layer.close(loadIndex);
//                        if (parseInt(retObj.status) === 0) {
//                            loadIndex && layer.close(loadIndex);
//                            layer.msg('登录成功,欢迎:' + retObj.Username + '用户,即将跳转', {icon: 1});
//                            setTimeout(function () {
//                                location.href = 'Home'
//                            }, 1500);
//                        } else if (parseInt(retObj.status) === 2) {
//                            loadIndex && layer.close(loadIndex);
//                            layer.msg('验证码不正确', {icon: 2});
//                            $('#changeCode').click(); //刷新验证码
//                        } else {
//                            loadIndex && layer.close(loadIndex);
//                            layer.msg(retObj.status_information, {icon: 2});
//                        }
//
//                    }, 'json');
//                return false;
//                User/Login_tojudge
                });
            }());

        }
    );
</script>
</body>

</html>